#!/bin/bash # It is recommended to test the script on a local machine for its purpose and effects. # ManageEngine Desktop Central will not be responsible for any # damage/loss to the data/setup based on the behavior of the script. # Description - Script to revoke admin rights in Mac # Script Arguments - "" # Configuration - COMPUTER USERNAME=$1 sudo dseditgroup -o edit -d "$USERNAME" -t user admin errcode=$? if [ "$errcode" -ne 0 ]; then echo "" echo "Failed with errorcode $errcode" 1>&2 echo "" exit 1 fi echo "Admin rights revoked for user $USERNAME" 1>&2